package com.example.lcqexcel.test;

import com.alibaba.excel.event.NotRepeatExecutor;
import com.alibaba.excel.write.handler.RowWriteHandler;
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
import org.apache.poi.ss.usermodel.Row;

/**
 * Set the row height strategy
 *
 * @author Jiaju Zhuang
 */
public class MyRowHeightStyleStrategy implements RowWriteHandler, NotRepeatExecutor {
    private int rowNum;
    private short rowHeight;

    @Override
    public String uniqueValue() {
        return "RowHighStyleStrategy";
    }

    public MyRowHeightStyleStrategy(int rowNum, Short rowHeight) {
        this.rowNum = rowNum;
        this.rowHeight = rowHeight;
    }

    @Override
    public void beforeRowCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Integer rowIndex,
        Integer relativeRowIndex, Boolean isHead) {

    }

    @Override
    public void afterRowCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row,
        Integer relativeRowIndex, Boolean isHead) {

    }

    @Override
    public void afterRowDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row,
        Integer relativeRowIndex, Boolean isHead) {
        if (isHead == null) {
            return;
        }

  //      if (!isHead && row.getRowNum()==rowNum) {
  //          row.setHeightInPoints(rowHeight);
  //       }
    }
}
